export default (_self, h) => {
	return h(
		"el-upload",
		{
			props: {
				"file-list": _self.obj.value || [],
				action: _self.obj.action,
				"on-preview": file => {
					_self.obj.dialogImageUrl = file.url;
					_self.obj.dialogVisible = true;
				},
				"on-remove": (file, fileList) => {
					_self.obj.value = fileList;
				},
				"on-success": (response, file, fileList) => {
					_self.obj.value = fileList;
				},
				disabled: !_self.obj.status,
				drag: true,
				multiple: true,
			},
			attrs: {},
			style: {
				cursor: !_self.obj.status ? "not-allowed" : "",
			},
		},
		[
			h("i", {
				class: ["el-icon-upload"],
			}),
			h(
				"div",
				{
					class: ["el-upload__text"],
				},
				["将文件拖到此处，或", h("em", {}, "点击上传")]
			),
			h(
				"div",
				{
					class: ["el-upload__tip"],
				},
				"只能上传jpg/png文件，且不超过500kb"
			),
		]
	);
};

export const fileConf = {
	status: true, // 启用状态，0启用；1停用
	elementWidth: "100%",
	elementType: "file", // 对应数据库内类型
	elementName: "附 件", // 控件左侧label内容
	detailList: [], // 选项内数据
	action: "https://jsonplaceholder.typicode.com/posts/",
	multiple: false,
	icon: "el-icon-folder",
	required: false, // 是否必填
	rules: [],
};
